]
};
-const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
- 'bluetooth-applet': 'bluetooth',
- 'gnome-volume-control-applet': 'volume', // renamed to gnome-sound-applet
- // when moved to control center
- 'gnome-sound-applet': 'volume',
- 'nm-applet': 'network',
- 'gnome-power-manager': 'battery',
- 'keyboard': 'keyboard',
- 'a11y-keyboard': 'a11y',
- 'kbd-scrolllock': 'keyboard',
- 'kbd-numlock': 'keyboard',
- 'kbd-capslock': 'keyboard',
- 'ibus-ui-gtk': 'keyboard'
-};
-
const FdoNotificationDaemon = new Lang.Class({
Name: 'FdoNotificationDaemon',
this._nextNotificationId = 1;
- Shell.WindowTracker.get_default().connect('notify::focus-app', Lang.bind(this, this._onFocusAppChanged));
- Main.overview.connect('hidden', Lang.bind(this, this._onFocusAppChanged));
-
- this._trayManager = new Shell.TrayManager();
- this._trayIconAddedId = this._trayManager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
- this._trayIconRemovedId = this._trayManager.connect('tray-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
- this._trayManager.manage_screen(global.screen, Main.messageTray.actor);
+ Shell.WindowTracker.get_default().connect('notify::focus-app',
+ Lang.bind(this, this._onFocusAppChanged));
+ Main.overview.connect('hidden',
+ Lang.bind(this, this._onFocusAppChanged));
},
_imageForNotificationData: function(hints) {
return null;
},
- _lookupSource: function(title, pid, trayIcon) {
+ _lookupSource: function(title, pid) {
for (let i = 0; i < this._sources.length; i++) {
let source = this._sources[i];
- if (source.pid == pid &&
- (source.initialTitle == title || source.trayIcon || trayIcon))
+ if (source.pid == pid && source.initialTitle == title)
return source;
}
return null;
//
// Either a pid or ndata.notification is needed to retrieve or
// create a source.
- _getSource: function(title, pid, ndata, sender, trayIcon) {
+ _getSource: function(title, pid, ndata, sender) {
if (!pid && !(ndata && ndata.notification))
return null;
if (ndata && ndata.notification)
return ndata.notification.source;
- let source = this._lookupSource(title, pid, trayIcon);
+ let source = this._lookupSource(title, pid);
if (source) {
source.setTitle(title);
return source;
}
- let source = new FdoNotificationDaemonSource(title, pid, sender, trayIcon, ndata ? ndata.hints['desktop-entry'] : null);
+ let source = new FdoNotificationDaemonSource(title, pid, sender, ndata ? ndata.hints['desktop-entry'] : null);
this._sources.push(source);
source.connect('destroy', Lang.bind(this, function() {
_emitActionInvoked: function(id, action) {
this._dbusImpl.emit_signal('ActionInvoked',
GLib.Variant.new('(us)', [id, action]));
- },
-
- _onTrayIconAdded: function(o, icon) {
- let wmClass = icon.wm_class ? icon.wm_class.toLowerCase() : '';
- if (STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass] !== undefined)
- return;
-
- let source = this._getSource(icon.title || icon.wm_class || C_("program", "Unknown"), icon.pid, null, null, icon);
- },
-
- _onTrayIconRemoved: function(o, icon) {
- let source = this._lookupSource(null, icon.pid, true);
- if (source)
- source.destroy();
}
});
Name: 'FdoNotificationDaemonSource',
Extends: MessageTray.Source,
- _init: function(title, pid, sender, trayIcon, appId) {
+ _init: function(title, pid, sender, appId) {
// Need to set the app before chaining up, so
// methods called from the parent constructor can find it
- this.trayIcon = trayIcon;
this.pid = pid;
this.app = this._getApp(appId);
Lang.bind(this, this._onNameVanished));
else
this._nameWatcherId = 0;
-
- if (this.trayIcon) {
- // Try again finding the app, using the WM_CLASS from the tray icon
- this._setSummaryIcon(this.trayIcon);
- this.useNotificationIcon = false;
- }
},
_createPolicy: function() {
// of which аre removed from DBus immediately.
// Sender being removed from DBus would normally result in a tray icon being removed,
// so allow the code path that handles the tray icon being removed to handle that case.
- if (!this.trayIcon && this.app)
+ if (this.app)
this.destroy();
},
processNotification: function(notification, gicon) {
if (gicon)
this._gicon = gicon;
- if (!this.trayIcon)
- this.iconUpdated();
+ this.iconUpdated();
let tracker = Shell.WindowTracker.get_default();
if (notification.resident && this.app && tracker.focus_app == this.app)
this.notify(notification);
},
- handleSummaryClick: function(button) {
- if (!this.trayIcon)
- return false;
-
- let event = Clutter.get_current_event();
-
- // Left clicks are passed through only where there aren't unacknowledged
- // notifications, so it possible to open them in summary mode; right
- // clicks are always forwarded, as the right click menu is not useful for
- // tray icons
- if (button == 1 &&
- this.notifications.length > 0)
- return false;
-
- let id = global.stage.connect('deactivate', Lang.bind(this, function () {
- global.stage.disconnect(id);
- this.trayIcon.click(event);
- }));
-
- Main.overview.hide();
- return true;
- },
-
_getApp: function(appId) {
let app;
if (app != null)
return app;
- if (this.trayIcon) {
- app = Shell.AppSystem.get_default().lookup_startup_wmclass(this.trayIcon.wm_class);
- if (app != null)
- return app;
-
- app = Shell.AppSystem.get_default().lookup_desktop_wmclass(this.trayIcon.wm_class);
- if (app != null)
- return app;
- }
-
if (appId) {
app = Shell.AppSystem.get_default().lookup_app(appId + '.desktop');
if (app != null)
},
_lastNotificationRemoved: function() {
- if (!this.trayIcon)
- this.destroy();
+ this.destroy();
},
openApp: function() {
},
createIcon: function(size) {
- if (this.trayIcon) {
- return new Clutter.Clone({ width: size,
- height: size,
- source: this.trayIcon });
- } else if (this.app) {
+ if (this.app) {
return this.app.create_icon_texture(size);
} else if (this._gicon) {
return new St.Icon({ gicon: this._gicon,